<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <script>
    function Getlist(numlist,target){
      for (let i = 0; i < numlist.length; i++) {
        let jian=target-numlist[i]
        let index= numlist.indexOf(jian)
        if (index>-1&&index!=i) {
          return [i,index]
          break; 
        }
      }
    }
    console.log(' Getlist([2,7,11,15], 9)', Getlist([2,7,11,15], 9));
  </script>
</body>
</html>